﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimbreRecognition
{
    //Deprecated
    public class Window
    {
        public float[] window;
        public int n;

        public Window(int windowSize)
        {
            n = windowSize;

            // Make a Hamming window
            window = new float[n];
            for (int i = 0; i < n; i++)
            {
                window[i] = 0.54f - 0.46f * (float)Math.Cos(2 * Math.PI * i / (n - 1));
            }
        }

        public void applyWindow(float[] buffer)
        {
            for (int i = 0; i < n; i++)
            {
                buffer[i] *= window[i];
            }
        }
    }
}
